pub force_copy_zerosized: bool,
pub subpath: Option<PathBuf>,
pub devino_to_csum_cache: Option<RepoDevInoCache>,
+ /// A callback function to decide which files and directories will be checked out from the
+ /// repo. See the documentation on [RepoCheckoutFilter](struct.RepoCheckoutFilter.html) for more
+ /// information on the signature.
+ ///
+ /// # Panics
+ /// This callback may not panic. If it does, `abort()` will be called to avoid unwinding across
+ /// an FFI boundary and into the libostree C code (which is Undefined Behavior). If you prefer to
+ /// swallow the panic rather than aborting, you can use `std::panic::catch_unwind` inside your
+ /// callback to catch and silence any panics that occur.
pub filter: Option<RepoCheckoutFilter>,
pub sepolicy: Option<SePolicy>,
pub sepolicy_prefix: Option<String>,
result.to_glib()
}
+/// Unwind-safe trampoline to call the Rust filter callback. See [filter_trampoline](fn.filter_trampoline.html).
+/// This function additionally catches panics and aborts to avoid unwinding into C code.
pub(super) unsafe extern "C" fn filter_trampoline_unwindsafe(
repo: *mut OstreeRepo,
path: *const c_char,
})
}
+/// Print a panic message and the value to stderr, if we can.
+///
+/// If the panic value is either `&str` or `String`, we print it. Otherwise, we don't.
fn print_panic(panic: Box<dyn Any>) {
eprintln!("A Rust callback invoked by C code panicked.");
eprintln!("Unwinding across FFI boundaries is Undefined Behavior so abort() will be called.");